<?php
/**
 * 错误提示页
 * @author wangtao
 * @version 2010.11.22
 */

class ErrorPage
{
	public static function E404()
	{
		$views = new smasrty();
		$title = '404错误，找不到此页面!';
		$views->assign('WEBROOT', WEBROOT);
		$views->assign('title', $title);
		$views->display('404.html');
		exit;
	}
	
	public static function e($errno, $errstr, $errfile, $errline)
	{
		if ($errno == 8) return true;
		#print_r($errno . $errstr . $errfile . $errline);return true;
		$views = new smasrty();
		$title = '404错误，找不到此页面!';
		$views->assign('WEBROOT', WEBROOT);
		$views->assign('title', $title);
		$views->display('404.html');
		exit;
	}
	
	public static function e1($errno, $errstr, $errfile, $errline)
	{
		return true;
	}
}

function e()
{
}

function myErrorHandler($errno, $errstr, $errfile, $errline)
{
	switch ($errno)
  	{
  		case E_USER_ERROR:
  			echo "<b>My ERROR</b> [$errno] $errstr<br />\n";
      		echo "  Fatal error on line $errline in file $errfile";
      		echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
      		echo "Aborting...<br />\n";
      		exit(1);
      		break;

		case E_USER_WARNING:
			echo "<b>My WARNING</b> [$errno] $errstr<br />\n";
			break;

		case E_USER_NOTICE:
			echo "<b>My NOTICE</b> [$errno] $errstr<br />\n";
			break;

		default:
			echo "Unknown error type: [$errno] $errstr<br />\n";
			break;
	}
	
	/* Don't execute PHP internal error handler */
	return true;
}